#include "SRPopulation.h"

SRPopulation::SRPopulation(Box* pBox) : Population( pBox )
{
}
SRPopulation::SRPopulation(Box* pBox , int flag) : Population( pBox, flag )
{
	this->m_pBox=pBox;

	if (flag==1) {
		for (int i=0; i < this->m_pBox->populationSize; i++)
		{
			Chromosome *pChrom = new SRChromosome(this->m_pBox);
			this->m_tabChromos.push_back(pChrom );
			//pChrom->print();
			
		}	
	}
}


SRPopulation::~SRPopulation(void)
{
}
Chromosome * SRPopulation::copyChromosome(Chromosome* old)
{
	Chromosome *newChromo = new SRChromosome(this->m_pBox);
	std::vector<Gene*> m_Genes = old->getGenes();
	std::vector<Gene*> n_Genes;
	for(int i=0;i<m_Genes.size();i++){
		SRGene* nGene = new SRGene(this->m_pBox);
		Gene * oGene=m_Genes[i];
		nGene->setWhole(oGene->stringToVec(oGene->getWhole()));
		n_Genes.push_back(nGene);
	}
	newChromo->setGenes(n_Genes);;
	return newChromo;
}